/*************************************
 **   @author: 野狼上校               **
 **   @create: 2024-04-03 11:42      **
 **   @version: 1.0                  **
 *************************************/
/**  静态路由  **/

import {createRouter, createWebHistory, Router, RouteRecordRaw} from "vue-router";

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/login"
    },
    {
        path: "/login",
        name: "login",
        meta: {
            title: "登录"
        },
        component: () => import("@/views/login.vue")
    },
    {
        path: "/main",
        name: "main",
        meta: {
            title: "主页面"
        },
        component: () => import("@/views/layout/index.vue"),
        children: [
            {
                path: "/home",
                name: "home",
                meta: {
                    title: "首页"
                },
                component: () => import("@/views/home.vue")
            },
            // 系统管理
            {
                path: "/user",
                name: "user",
                meta: {
                    title: "用户管理"
                },
                component: () => import("@/views/system/user/index.vue")
            },
            {
                path: "/role",
                name: "role",
                meta: {
                    title: "角色管理"
                },
                component: () => import("@/views/system/role/index.vue")
            },
            {
                path: "/resource",
                name: "resource",
                meta: {
                    title: "资源管理"
                },
                component: () => import("@/views/system/resource/index.vue")
            },
            // 碰撞管理
            {
                path: "/device",
                name: "device",
                meta: {
                    title: "设备管理"
                },
                component: () => import("@/views/crash/device/index.vue")
            },
            {
                path: "/threshold",
                name: "threshold",
                meta: {
                    title: "阈值管理"
                },
                component: () => import("@/views/crash/threshold/index.vue"),
            },
            {
                path: "/thresholdDesc",
                name: "thresholdDesc",
                meta: {
                    title: "阈值详情"
                },
                component: () => import("@/views/crash/threshold/desc.vue")
            },
            {
                path: "/alarm",
                name: "alarm",
                meta: {
                    title: "预警管理"
                },
                component: () => import("@/views/crash/alarm/index.vue")
            },
        ]
    },
]

/*创建路由*/
const router: Router = createRouter({
    // history: createWebHashHistory(), //访问路径出现#
    history: createWebHistory(),
    routes,
})

/*导出*/
export default router;